using System;
using System.Text;
using System.Data;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;


namespace Open.Data.Persistence
{
    public interface IPersistable
	{
	}

    public interface IConcurrency
    {
        Concurrency GetConcurrency();
        void SetConcurrency(Concurrency concurrency);
    }

	public interface IQuery
	{
        Type Type {get;}
        Type ActivateType {get;}
        Conditions Where {get; }
        Columns GroupBy {get; }
        Conditions Having {get; }
        Columns OrderBy {get; }
        IQueries SubQueries {get; set;}
        IQuery Parent {get; set;}
        bool Fill {get; set;}
        Columns JoinFrom {get; set;}
        Columns JoinTo {get; set;}
        JoinType JoinType {get;set;}

        void ExecuteQuery(QueryDataAdapter adapter);
        void AppendHashCode(StringBuilder builder);
	}

    public interface IQueries : IList<IQuery>
    {
        void AppendHashCode(StringBuilder builder);
    }

    public interface IView
    {
        Type UnderlyingType();
    }

    public interface IColumn
    {
        PropertyInfo PropertyInfo { get;}
    }

	public interface ISort: IColumn
	{
		SortDirection Direction {get; set;}
	}

    public interface IAggregate: IColumn
    {
        AggregateType AggregateType { get; set;}
    }

    public interface IIndexAttribute
    {
        bool Unique { get; set; }
    }

    public interface IPrimaryKeyAttribute
    {

    }

    public interface IReferenceAttribute
    {

    }

    public interface ILiteral
    {
        string GetValue();
    }

    public interface IParameter
    {
        string Name { get; set; }
        Type Type { get; }
        string GetValue();
    }

    public interface IProvider
    {
        ReflectionParser CreateParser();
        CacheItem CreateCacheEntry(Type type, ReflectionParser parser);
    }

    public interface IDataBinder
    {
        IQuery Query { get; set; }
        QueryDataAdapter DataAdapter { get; set; }
        bool HasChanged { get; set; }
        Formatter Formatter { get; set; }

        void Bind();
        IPersistable GetItem();
        void ClearItem();
    }
}
